package com.leisurexi.concurrency.future;

/**
 * 任务执行类
 *
 * @author: leisurexi
 * @date: 2021-05-09 13:54
 */
public class TaskExecutor implements Runnable {

    private TaskCallable<TaskResult> taskCallable;

    private String taskParameter;

    public TaskExecutor(TaskCallable<TaskResult> taskCallable, String taskParameter) {
        this.taskCallable = taskCallable;
        this.taskParameter = taskParameter;
    }

    @Override
    public void run() {
        TaskResult result = new TaskResult();
        result.setStatus(1);
        result.setMessage(this.taskParameter);
        result.setResult("异步回调成功");
        taskCallable.callable(result);
    }

}
